package org.easymodelers.gmf;

import java.io.File;
import java.io.IOException;

import org.easymodelers.gmf.creator.GmfGraphCreator;
import org.easymodelers.gmf.creator.GmfMapCreator;
import org.easymodelers.gmf.creator.GmfToolCreator;
import org.easymodelers.gmf.creator.impl.DefaultGmfGraphCreator;
import org.easymodelers.gmf.creator.impl.DefaultGmfMapCreator;
import org.easymodelers.gmf.creator.impl.DefaultGmfToolCreator;
import org.easymodelers.modeler.data.Modeler;
import org.easymodelers.processing.PreModelsCreator;

public class GmfPreModelsCreator implements PreModelsCreator {
	private GmfGraphCreator graphCreator = new DefaultGmfGraphCreator();
	private GmfToolCreator toolCreator = new DefaultGmfToolCreator();
	private GmfMapCreator mapCreator = new DefaultGmfMapCreator();

	public void createPreModels(String modelPath, Modeler modeler) throws IOException {
		if (!modelPath.endsWith(File.separator)) {
			modelPath += File.separator;
		}

		String graphModelPath = modelPath + modeler.getName() + ".gmfgraph";
		String toolModelPath = modelPath + modeler.getName() + ".gmftool";
		String mapModelPath = modelPath + modeler.getName() + ".gmfmap";
		
		graphCreator.createGmfGraph(graphModelPath, modeler);
		toolCreator.createGmfTool(toolModelPath, modeler);
		mapCreator.createGmfMap(mapModelPath, modeler);
	}

	public GmfGraphCreator getGraphCreator() {
		return graphCreator;
	}

	public void setGraphCreator(GmfGraphCreator graphCreator) {
		this.graphCreator = graphCreator;
	}

	public GmfToolCreator getToolCreator() {
		return toolCreator;
	}

	public void setToolCreator(GmfToolCreator toolCreator) {
		this.toolCreator = toolCreator;
	}

	public GmfMapCreator getMapCreator() {
		return mapCreator;
	}

	public void setMapCreator(GmfMapCreator mapCreator) {
		this.mapCreator = mapCreator;
	}

}
